package com.zhulei.biji.suanfa.pace;

/**
 * @description:
 * @author: zhulei
 * @create: 2025-03-14 10:14
 **/
public class IsBalanced {
    public static void main(String[] args) {
        System.out.println(isBalanced("24123"));
    }

    public static boolean isBalanced(String num) {
        int j=0,o=0;
        for (int i = 0; i < num.length(); i++) {
            Integer value = Integer.valueOf(num.charAt(i) + "");
            if (i%2==0)
                o+=value;
            else
                j+=value;
        }
        return j==o;
    }
}
